Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 19: Controlling Shading

../ch19/19fig26.gif
Figure 19.26

An elevation grid using a special shading effect.

19fig26.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Shape {
    appearance Appearance {
        material Material { }
    }
    geometry ElevationGrid {
        xDimension 5
        zDimension 5
        xSpacing   1.0
        zSpacing   1.0
        solid      FALSE
        height [
            0.0, 0.0, 0.0, 0.0, 0.0, 
            0.0, 0.0, 0.0, 0.0, 0.0, 
            0.0, 0.0, 0.0, 0.0, 0.0, 
            0.0, 0.0, 0.0, 0.0, 0.0, 
            0.0, 0.0, 0.0, 0.0, 0.0, 
        ]
        normalPerVertex TRUE
        normal Normal {
            vector [
            # First row
                 0.0 1.0  0.0,   0.0 1.0  0.0, 
                 0.0 1.0  0.0,   0.0 1.0  0.0, 
                 0.0 1.0  0.0, 
            # Second row
                 0.0 1.0  0.0,  -0.3 0.3 -0.3, 
                 0.0 0.5 -0.5,   0.3 0.3 -0.3, 
                 0.0 1.0  0.0, 
            # Third row
                 0.0 1.0  0.0,  -0.5 0.5  0.0, 
                -0.5 0.5  0.0,   0.5 0.5  0.0, 
                 0.0 1.0  0.0, 
            # Fourth row
                 0.0 1.0  0.0,  -0.3 0.3 -0.3, 
                 0.0 0.5 -0.5,   0.3 0.3 -0.3, 
                 0.0 1.0  0.0, 
            # Fifth row
                 0.0 1.0  0.0,   0.0 1.0  0.0, 
                 0.0 1.0  0.0,   0.0 1.0  0.0, 
                 0.0 1.0  0.0, 
            ]
        }
    }
}